\(\int (a+b \sec (c+d x))^2 \tan (c+d x) \, dx\) [275]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [A] (verification not implemented)
   Maxima [A] (verification not implemented)
   Giac [B] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 19, antiderivative size = 47 \[ \int (a+b \sec (c+d x))^2 \tan (c+d x) \, dx=-\frac {a^2 \log (\cos (c+d x))}{d}+\frac {2 a b \sec (c+d x)}{d}+\frac {b^2 \sec ^2(c+d x)}{2 d} \]

[Out]

-a^2*ln(cos(d*x+c))/d+2*a*b*sec(d*x+c)/d+1/2*b^2*sec(d*x+c)^2/d

Rubi [A] (verified)

Time = 0.04 (sec) , antiderivative size = 47, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.105, Rules used = {3970, 45} \[ \int (a+b \sec (c+d x))^2 \tan (c+d x) \, dx=-\frac {a^2 \log (\cos (c+d x))}{d}+\frac {2 a b \sec (c+d x)}{d}+\frac {b^2 \sec ^2(c+d x)}{2 d} \]

[In]

Int[(a + b*Sec[c + d*x])^2*Tan[c + d*x],x]

[Out]

-((a^2*Log[Cos[c + d*x]])/d) + (2*a*b*Sec[c + d*x])/d + (b^2*Sec[c + d*x]^2)/(2*d)

Rule 45

Int[((a_.) + (b_.)*(x_))^(m_.)*((c_.) + (d_.)*(x_))^(n_.), x_Symbol] :> Int[ExpandIntegrand[(a + b*x)^m*(c + d
*x)^n, x], x] /; FreeQ[{a, b, c, d, n}, x] && NeQ[b*c - a*d, 0] && IGtQ[m, 0] && ( !IntegerQ[n] || (EqQ[c, 0]
&& LeQ[7*m + 4*n + 4, 0]) || LtQ[9*m + 5*(n + 1), 0] || GtQ[m + n + 2, 0])

Rule 3970

Int[cot[(c_.) + (d_.)*(x_)]^(m_.)*(csc[(c_.) + (d_.)*(x_)]*(b_.) + (a_))^(n_), x_Symbol] :> Dist[-(-1)^((m - 1
)/2)/(d*b^(m - 1)), Subst[Int[(b^2 - x^2)^((m - 1)/2)*((a + x)^n/x), x], x, b*Csc[c + d*x]], x] /; FreeQ[{a, b
, c, d, n}, x] && IntegerQ[(m - 1)/2] && NeQ[a^2 - b^2, 0]

Rubi steps \begin{align*} \text {integral}& = \frac {\text {Subst}\left (\int \frac {(a+x)^2}{x} \, dx,x,b \sec (c+d x)\right )}{d} \\ & = \frac {\text {Subst}\left (\int \left (2 a+\frac {a^2}{x}+x\right ) \, dx,x,b \sec (c+d x)\right )}{d} \\ & = -\frac {a^2 \log (\cos (c+d x))}{d}+\frac {2 a b \sec (c+d x)}{d}+\frac {b^2 \sec ^2(c+d x)}{2 d} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.05 (sec) , antiderivative size = 42, normalized size of antiderivative = 0.89 \[ \int (a+b \sec (c+d x))^2 \tan (c+d x) \, dx=\frac {-2 a^2 \log (\cos (c+d x))+4 a b \sec (c+d x)+b^2 \sec ^2(c+d x)}{2 d} \]

[In]

Integrate[(a + b*Sec[c + d*x])^2*Tan[c + d*x],x]

[Out]

(-2*a^2*Log[Cos[c + d*x]] + 4*a*b*Sec[c + d*x] + b^2*Sec[c + d*x]^2)/(2*d)

Maple [A] (verified)

Time = 0.72 (sec) , antiderivative size = 40, normalized size of antiderivative = 0.85

method result size
derivativedivides \(\frac {\frac {\sec \left (d x +c \right )^{2} b^{2}}{2}+2 a b \sec \left (d x +c \right )+a^{2} \ln \left (\sec \left (d x +c \right )\right )}{d}\) \(40\)
default \(\frac {\frac {\sec \left (d x +c \right )^{2} b^{2}}{2}+2 a b \sec \left (d x +c \right )+a^{2} \ln \left (\sec \left (d x +c \right )\right )}{d}\) \(40\)
parts \(\frac {a^{2} \ln \left (1+\tan \left (d x +c \right )^{2}\right )}{2 d}+\frac {b^{2} \sec \left (d x +c \right )^{2}}{2 d}+\frac {2 a b \sec \left (d x +c \right )}{d}\) \(50\)
risch \(i a^{2} x +\frac {2 i a^{2} c}{d}+\frac {2 b \left (2 a \,{\mathrm e}^{3 i \left (d x +c \right )}+b \,{\mathrm e}^{2 i \left (d x +c \right )}+2 \,{\mathrm e}^{i \left (d x +c \right )} a \right )}{d \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )^{2}}-\frac {a^{2} \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )}{d}\) \(94\)

[In]

int((a+b*sec(d*x+c))^2*tan(d*x+c),x,method=_RETURNVERBOSE)

[Out]

1/d*(1/2*sec(d*x+c)^2*b^2+2*a*b*sec(d*x+c)+a^2*ln(sec(d*x+c)))

Fricas [A] (verification not implemented)

none

Time = 0.27 (sec) , antiderivative size = 51, normalized size of antiderivative = 1.09 \[ \int (a+b \sec (c+d x))^2 \tan (c+d x) \, dx=-\frac {2 \, a^{2} \cos \left (d x + c\right )^{2} \log \left (-\cos \left (d x + c\right )\right ) - 4 \, a b \cos \left (d x + c\right ) - b^{2}}{2 \, d \cos \left (d x + c\right )^{2}} \]

[In]

integrate((a+b*sec(d*x+c))^2*tan(d*x+c),x, algorithm="fricas")

[Out]

-1/2*(2*a^2*cos(d*x + c)^2*log(-cos(d*x + c)) - 4*a*b*cos(d*x + c) - b^2)/(d*cos(d*x + c)^2)

Sympy [A] (verification not implemented)

Time = 0.18 (sec) , antiderivative size = 60, normalized size of antiderivative = 1.28 \[ \int (a+b \sec (c+d x))^2 \tan (c+d x) \, dx=\begin {cases} \frac {a^{2} \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 d} + \frac {2 a b \sec {\left (c + d x \right )}}{d} + \frac {b^{2} \sec ^{2}{\left (c + d x \right )}}{2 d} & \text {for}\: d \neq 0 \\x \left (a + b \sec {\left (c \right )}\right )^{2} \tan {\left (c \right )} & \text {otherwise} \end {cases} \]

[In]

integrate((a+b*sec(d*x+c))**2*tan(d*x+c),x)

[Out]

Piecewise((a**2*log(tan(c + d*x)**2 + 1)/(2*d) + 2*a*b*sec(c + d*x)/d + b**2*sec(c + d*x)**2/(2*d), Ne(d, 0)),
 (x*(a + b*sec(c))**2*tan(c), True))

Maxima [A] (verification not implemented)

none

Time = 0.20 (sec) , antiderivative size = 42, normalized size of antiderivative = 0.89 \[ \int (a+b \sec (c+d x))^2 \tan (c+d x) \, dx=-\frac {2 \, a^{2} \log \left (\cos \left (d x + c\right )\right ) - \frac {4 \, a b \cos \left (d x + c\right ) + b^{2}}{\cos \left (d x + c\right )^{2}}}{2 \, d} \]

[In]

integrate((a+b*sec(d*x+c))^2*tan(d*x+c),x, algorithm="maxima")

[Out]

-1/2*(2*a^2*log(cos(d*x + c)) - (4*a*b*cos(d*x + c) + b^2)/cos(d*x + c)^2)/d

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 191 vs. \(2 (45) = 90\).

Time = 0.36 (sec) , antiderivative size = 191, normalized size of antiderivative = 4.06 \[ \int (a+b \sec (c+d x))^2 \tan (c+d x) \, dx=\frac {2 \, a^{2} \log \left ({\left | -\frac {\cos \left (d x + c\right ) - 1}{\cos \left (d x + c\right ) + 1} + 1 \right |}\right ) - 2 \, a^{2} \log \left ({\left | -\frac {\cos \left (d x + c\right ) - 1}{\cos \left (d x + c\right ) + 1} - 1 \right |}\right ) + \frac {3 \, a^{2} + 8 \, a b + \frac {6 \, a^{2} {\left (\cos \left (d x + c\right ) - 1\right )}}{\cos \left (d x + c\right ) + 1} + \frac {8 \, a b {\left (\cos \left (d x + c\right ) - 1\right )}}{\cos \left (d x + c\right ) + 1} - \frac {4 \, b^{2} {\left (\cos \left (d x + c\right ) - 1\right )}}{\cos \left (d x + c\right ) + 1} + \frac {3 \, a^{2} {\left (\cos \left (d x + c\right ) - 1\right )}^{2}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{2}}}{{\left (\frac {\cos \left (d x + c\right ) - 1}{\cos \left (d x + c\right ) + 1} + 1\right )}^{2}}}{2 \, d} \]

[In]

integrate((a+b*sec(d*x+c))^2*tan(d*x+c),x, algorithm="giac")

[Out]

1/2*(2*a^2*log(abs(-(cos(d*x + c) - 1)/(cos(d*x + c) + 1) + 1)) - 2*a^2*log(abs(-(cos(d*x + c) - 1)/(cos(d*x +
 c) + 1) - 1)) + (3*a^2 + 8*a*b + 6*a^2*(cos(d*x + c) - 1)/(cos(d*x + c) + 1) + 8*a*b*(cos(d*x + c) - 1)/(cos(
d*x + c) + 1) - 4*b^2*(cos(d*x + c) - 1)/(cos(d*x + c) + 1) + 3*a^2*(cos(d*x + c) - 1)^2/(cos(d*x + c) + 1)^2)
/((cos(d*x + c) - 1)/(cos(d*x + c) + 1) + 1)^2)/d

Mupad [B] (verification not implemented)

Time = 13.20 (sec) , antiderivative size = 81, normalized size of antiderivative = 1.72 \[ \int (a+b \sec (c+d x))^2 \tan (c+d x) \, dx=\frac {4\,a\,b-{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2\,\left (4\,a\,b-2\,b^2\right )}{d\,\left ({\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^4-2\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2+1\right )}+\frac {2\,a^2\,\mathrm {atanh}\left ({\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2\right )}{d} \]

[In]

int(tan(c + d*x)*(a + b/cos(c + d*x))^2,x)

[Out]

(4*a*b - tan(c/2 + (d*x)/2)^2*(4*a*b - 2*b^2))/(d*(tan(c/2 + (d*x)/2)^4 - 2*tan(c/2 + (d*x)/2)^2 + 1)) + (2*a^
2*atanh(tan(c/2 + (d*x)/2)^2))/d